package com.spring.mvc.controller;

import com.spring.mvc.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;

/**
 * @author ZhuYouBin
 * @version 1.0.0
 * @Date: 2022/9/10 11:52
 * @Description
 */
@Controller
@RequestMapping("/jackson")
public class JackJsonController {

    @RequestMapping("/test")
    @ResponseBody
    public List<User> index(HttpServletRequest request) {
        List<User> list = new ArrayList<>();
        for (int i = 0; i < 3; i++) {
            User user = new User();
            user.setUsername("test_name_00" + i);
            user.setPassword("test_pass_00" + i);
            list.add(user);
        }
        return list;
    }
}
